import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/application/education/train_plan/get_offline_training_results_entity.dart';
import 'package:get/get.dart';

///职工培训成绩
class WorkersTrainAchievementController extends GetxController {
  ///获取相应数据  职工培训成绩
  List<GetOfflineTrainingResultsEntity>? data = [];

  @override
  void onInit() {
    super.onInit();
    getOfflineTrainingResults();
  }

  ///查询线下培训结果
  void getOfflineTrainingResults() async {
    final res = await HttpUtil().generateGetRequest<List<GetOfflineTrainingResultsEntity>>(
      Interface.getOfflineTrainingResults,
      queryParameters: {'planId': Get.arguments['id']},
    ).execute();
    res.onSuccess((result) {
      if (result.data != null) {
        data = result.data;
        update();
      }
    });
    res.onError((result) {});
  }
}
